$(document).ready(function(){
    /* ajax添加商品  */
    $('#shopping_group_add_goods').ajaxContent({
        event:'click', //mouseover
        loaderType:"img",
        loadingMsg:alioss_path+"/images/loading.gif",
        target:'#shopping_group_add_goods_ajaxContent'
    }).click(function(){
        $(this).hide();
        $('#shopping_group_add_goods_delete').show();
    });

    $('#shopping_group_add_goods_delete').click(function(){
        $(this).hide();
        $('#shopping_group_add_goods_ajaxContent').html('');
        $('#shopping_group_add_goods').show();
    });
    // 退拽效果
    $('tbody[nctype="shopping_group_data"]').sortable({ items: 'tr' });
    $('#goods_images').sortable({ items: 'li' });
});


/* 计算商品原价 */
function count_cost_price_sum(){
    data_price = $('td[nctype="shopping_group_data_price"]');
    if(typeof(data_price) != 'undefined'){
        var S_price = 0;
        data_price.each(function(){
            S_price += parseFloat($(this).html());
        });
        $('span[nctype="cost_price"]').html(S_price.toFixed(2));
    }else{
        $('span[nctype="cost_price"]').html('');
    }
}

/* 计算商品售价 */
function count_price_sum(){
    data_price = $('input[nctype="price"]');
    if(typeof(data_price) != 'undefined'){
        var S_price = 0;
        data_price.each(function(){
            S_price += parseFloat($(this).val());
        });
        $('#active_price').val(S_price.toFixed(2));
    }else{
        $('#active_price').val('');
    }
}